<html>
<head>
    <script src="./static/script/jes.js"></script>
    <script src="./static/script/dnt.js"></script>
    <link rel="stylesheet" href="./static/css/dnt.css" type="text/css">
</head>
<body>
<div id="header">
	<div id="logo">DNT WebTools <font size="2px">alpha</font> - Trinity</div>
		<div id="mainmenu">
		<ul>
			<li><a <?php echo printActiveMenu( "/" ) ?> href="/">Home</a></li>
			<li><a <?php echo printActiveMenu( "/LocalRepoBrowser.php", "/LocalRepo2Svn.php" ) ?> href="LocalRepoBrowser.php">Subversion</a></li>
<? if( is_login() ) { ?>
			<li><a href="/Logout.php">logout</a></li>
<? } ?>
		</ul>
	</div>
</div>
<?
if( !empty($bwstype) ) {
?>
<div id="repoTitle" class="repo_title"><?=$serviceId?> : <?=$repoId?></div>
<ol class="cate" >
	<li id="menu_ctab_1"><a href="#" onClick="goBrowser('list');">List</a></li>
	<li id="menu_ctab_2"><a href="#" onClick="goBrowser('status');">Status</a></li>
<?  if( empty($repo['trunk']) || empty($repo['tags']) ) { ?>
	<li id="menu_ctab_3"><a href="#" onClick="alert('TRUNK와 TAG버전의 비교를 지원하지 않는 프로젝트 입니다.');">HistoryDiff</a></li>
<?  } else {  ?>
	<li id="menu_ctab_3"><a href="#" onClick="goBrowser('historydiff');">HistoryDiff</a></li>
<?  } ?>
</ol>
<?  
	$splitPath = split('/', $path); 
	$pathMenu = "Repository Location : [<a href='javascript:goPath(\"\");'>root</a>";
	$menuTmpPath="";
	foreach( $splitPath as $sPath ) {
		if( !empty($sPath) ) {
			$menuTmpPath .= $sPath.'/';
			$pathMenu .= "/<a href='javascript:goPath(\"$menuTmpPath\");'>$sPath</a>";
		}
	}
	$pathMenu .= "]<br />";
	$pathMenu .= "SVN Command : 
					<a href='#' onClick='goUpdate();'>Update</a> | 
					<a href='#' onClick='goBrowser(\"diff\");'>Diff</a> |
					<a href='#' onClick='goCommit();'>Commit</a> |
					<a href='#' onClick='goBrowser(\"log\");'>Log</a> 
					<br />";
?>
<div class="ptab1" id="div_ctab_1"><?=$pathMenu?></div>
<div class="ptab1"  id="div_ctab_2"><?=$pathMenu?></div>
<div class="ptab1"  id="div_ctab_3"><?=$pathMenu?></div>

<script type="text/javascript">
    new UI.Tab('ctab',3, {menu_type:'css',snum:<?=getTabMenuNum($bwstype)?>, event_type:'click'})
</script>

<script>
    var serviceId = "<?php echo $serviceId ?>";
    var repoId = "<?php echo $repoId ?>";
    var filter = "<?php echo $filter ?>";
    var bwstype = "<?php echo $bwstype ?>";
    var path = "<?php echo $path ?>";
    function goPath( path ) {
        document.location.href = "LocalRepoBrowser.php?serviceid="+serviceId+"&repoid="+repoId+"&filter="+filter+"&bwstype="+bwstype+"&path="+path;
    }
    function goStatusFilter( filter ) {
        document.location.href = "LocalRepoBrowser.php?serviceid="+serviceId+"&repoid="+repoId+"&filter="+filter+"&bwstype="+bwstype+"&path="+path;
    }
    function goBrowser( bwstype ) {
        document.location.href = "LocalRepoBrowser.php?serviceid="+serviceId+"&repoid="+repoId+"&filter="+filter+"&bwstype="+bwstype+"&path="+path;
    }
    function goLogBrowser( addpath ) {
        document.location.href = "LocalRepoBrowser.php?serviceid="+serviceId+"&repoid="+repoId+"&filter="+filter+"&bwstype=log&path="+path+addpath;
    }
    function goDiffFileBrowser( bwstype, file ) {
        document.location.href = "LocalRepoBrowser.php?serviceid="+serviceId+"&repoid="+repoId+"&filter="+filter+"&bwstype="+bwstype+"&path="+path+"&file="+file;
    }
    function goCommit() {
        display = UI.$('commitMsgForm').style.display;
        if( display == 'none' ) {
            UI.$('commitMsgForm').style.display = '';
        }
        else if( display == '' )  {
            UI.$('commitMsgForm').style.display = 'none';
        }
    }
    function goUpdate() {
        document.location.href = "LocalRepo2Svn.php?serviceid="+serviceId+"&repoid="+repoId+"&path="+path+"&cmd=update";
    }
</script>
<?
}

function getTabMenuNum( $bwstype ) {
	switch( $bwstype ) {
		case "log";
			return 1;
		break;
		case "list";
			return 1;
		break;
		case "cat";
			return 1;
		break;
		case "status";
			return 2;
		break;
		case "historydiff";
			return 3;
		break;
		default;
			return 2;
		break;
	}
}

function printActiveMenu( $name, $name2='' ) {
	$fileName = $_SERVER["SCRIPT_NAME"];
	if( $fileName == $name or $fileName == $name2 )
		return "class=\"active\"";

	return "";
}

?>


